/*
 * WaitObject.cpp
 *
 *  Created on: Nov 6, 2011
 *      Author: mgibson
 */

#include "WaitObject.h"

WaitObject::WaitObject(int newsockfd, char* newbuffer,int length){
	type = READ;
	sockfd = newsockfd;
	buffer = newbuffer;
	blength = length;
	mutex = new pthread_mutex_t;
	cond = new pthread_cond_t;
	masterCond = NULL;
	masterMutex = NULL;
	masterBool = NULL;
	returnID = NULL;
}

WaitObject::WaitObject(pthread_mutex_t* newmutex, pthread_cond_t* newcond){
	type = PTHREAD;
	mutex = newmutex;
	cond = newcond;
	masterCond = NULL;
	masterMutex = NULL;
	masterBool = NULL;
	returnID = NULL;
}

WaitObject::~WaitObject() {
	pthread_mutex_destroy(mutex);
	pthread_cond_destroy(cond);
	delete mutex;
	delete cond;
}
